<?php
/**
 * @author Federico Mart�n Cano <canofedericomartin@gmail.com>
 * @todo Funciones de carga de ficheros css y js.
 * @copyright 23-01-11
 */
	function load_css($dir) {
		if(strripos($dir, ".css")){
			echo "<link type='text/css' rel='stylesheet' charset='utf-8' href='".$dir."' />";
		}else{
			$files = @scandir($dir);
			for ($i=0;$i<count($files);$i++) {
				if (count(str_split(strstr($files[$i],".css"))) > 1) echo "<link rel='stylesheet' type='text/css' href='".$dir.$files[$i]."' />";
			}
		}
	}
	function load_js($dir) {
		if(strripos($dir, ".js")){
			echo "<script type='text/javascript' charset='utf-8' src='".$dir."'></script>";
		}else{
			$files = @scandir($dir);
			for ($i=0;$i<count($files);$i++) {
				if (count(str_split(strstr($files[$i],".js"))) > 1) echo "<script type='text/javascript' charset='utf-8' src='".$dir.$files[$i]."'></script>";
			}
		}
	}
	function load_css_js() {
		//------- carga ra�z -------//
		load_css(DEV_LOCAL_ROOT."css/");
		load_js(DEV_LOCAL_ROOT."js/");
		//------- carga modulo -------//
		if (isset($_GET["section"])) {
			load_css("modules/".$_GET["section"]."/css/");
			load_js("modules/".$_GET["section"]."/js/");
			//------- carga acci�n -------//
			if (isset($_GET["action"])) {
				load_css("modules/".$_GET["section"]."/actions/".$_GET["action"]."/css/");
				load_js("modules/".$_GET["section"]."/actions/".$_GET["action"]."/js/");
			}
		}
	}
?>